import Vue from 'vue'
import VueRouter from 'vue-router'
// import AboutView from '../views/AboutView.vue'
// 解决NavigationDuplicated报错问题
//无语死了居然报错
// const originalPush = Router.prototype.push
// Router.prototype.push = function push (location) {
//   return originalPush.call(this, location).catch(err => err)
// }

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/view1'
  },
  {
    path: '/view1',
    name: 'view1',
    title: '抽奖页面',
    component: () => import('@/views/App1.vue'),
  },
  {
    path: '/view',
    name: 'view',
    title: '投票统计',
    component: () => import('@/views/AboutView.vue'),
  },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: ()=>import('@/views/AboutView.vue')
  // },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
